<?php
/* @var $this AgentRechargeController */
/* @var $model AgentRecharge */

$this->breadcrumbs=array(
	Yii::t('base','Recharge')=>array('admin'),
	Yii::t('base','Manage'),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#agent-recharge-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<h1><?php echo Yii::t('base','Manage Recharge');?></h1>

<?php echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>')?>

<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php if(yii::app()->user->level() != 1){?>
<a class="btn btn-small create" title="<?php echo Yii::t('base','Pay')?>" href="<?php echo Yii::app()->request->baseUrl; ?>/AgentRecharge/create?user_id=<?php echo yii::app()->user->id; if($_GET['flag'] == '3G'){ ?>&flag=3G"<?php }else{ ?>&flag=1"<?php } ?>><?php echo Yii::t('base','Pay')?></a>
<?php } ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'agent-recharge-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
        'itemsCssClass'=>'responsive table table-striped table-bordered',
       // 'pagerCssClass'=>'pagination pull-right',
    'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination',
	'cssFile'=>false,
	'template'=>'{items}{summary}{pager}',
	'columns'=>array(
		array('name'=>'recharge_time','headerHtmlOptions'=>array('style'=>'width:15%')),
                array('name'=>'recharge_number','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'recharge_type','value'=>'AgentRecharge::model()->getRechargeType($data->recharge_type)','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'package_id','value'=>'AgentRecharge::model()->getPackageName($data->package_id)','headerHtmlOptions'=>array('style'=>'width:10%'),'visible'=>yii::app()->user->level==8 || yii::app()->user->level==1),
		array('name'=>'agent_id','value'=>'AgentCompany::model()->getAgentName($data->user_id,$data->agent_id)','headerHtmlOptions'=>array('style'=>'width:10%')),
                array('name'=>'txnid','headerHtmlOptions'=>array('style'=>'width:10%')),
	),
)); ?>
